﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace web
{
    public partial class MasterPage : System.Web.UI.MasterPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                if (Session["apartado"] != null)
                {
                    if (Session["apartado"].ToString() == "tienda")
                    {
                        menuLateral.Items.Add(new MenuItem("Alquiler", "", "", "Tienda.aspx"));
                        menuLateral.Items.Add(new MenuItem("Venta", "", "", "Tiendaventa.aspx"));

                    }

                    if (Session["apartado"].ToString() == "contacto")
                    {
                        menuLateral.Items.Add(new MenuItem("Formulario", "", "", "Contacto.aspx"));
                        menuLateral.Items.Add(new MenuItem("Citas", "", "", "Citas.aspx"));

                    }
                }

                if (Session["usuario"] != null)
                {
                    HyperLink1.Enabled = false;
                    HyperLink1.Visible = false;
                    HyperLink2.Enabled = false;
                    HyperLink2.Visible = false;
                    lbBienv.Enabled = true;
                    lbBienv.Visible = true;
                    lbUsu.Text = Session["usuario"].ToString();
                    lbUsu.Enabled = true;
                    lbUsu.Visible = true;
                    HyperLink3.Enabled = true;
                    HyperLink3.Visible = true;
                }
                else
                {
                    HyperLink1.Enabled = true;
                    HyperLink1.Visible = true;
                    HyperLink2.Enabled = true;
                    HyperLink2.Visible = true;
                    lbBienv.Enabled = false;
                    lbBienv.Visible = false;
                    lbUsu.Enabled = false;
                    lbUsu.Visible = false;
                    HyperLink3.Enabled = false;
                    HyperLink3.Visible = false;
                }


            }






        }

        protected void menuSuperior_MenuItemClick(object sender, MenuEventArgs e)
        {
            menuLateral.Items.Clear();
            if (menuSuperior.SelectedValue.ToString() == "tienda")
            {
                Response.Redirect("Tienda.aspx");
            }

        }
    }
}
